<template>
    <div>
        <van-row>
            <van-col span="8">
                <van-sidebar v-model="active">
                    <van-sidebar-item v-for="i in data" :title="i.cat_name" />
                </van-sidebar>
            </van-col>
            <van-col span="16">
                <div v-for="i in data[active]?.children">
                    <router-link :to="`/lb/${i.cat_name}`">
                        <h4>{{ i.cat_name }}</h4>
                        <van-grid :column-num="4">
                            <van-grid-item v-for="item in i.children" :icon="item.cat_icon" :text="item.cat_name" />
                        </van-grid>
                    </router-link>

                </div>
            </van-col>
        </van-row>
    </div>
</template>

<script setup>
import { ref } from 'vue';
const active = ref(0);
import { categoriesApi } from '@/api/api'
let data = ref([])
categoriesApi().then(res => {
    console.log(res);
    data.value = res.data.message
})
</script>

<style lang="scss" scoped></style>